﻿<html DIR="LTR" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ddue="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
  <head>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8" />
    <META NAME="save" CONTENT="history" />
    <title>getExportedKeys 方法 (SQLServerDatabaseMetaData)</title>
    
    <link rel="stylesheet" type="text/css" href="../local/Classic.css">
      
    </link>
    
    <script src="../local/script.js">
      
    </script><script src="../local/script_main.js">&amp;nbsp;</script>
  </head>
  <body>
    <!--Topic built:04/01/2010 05:03:28-->

    
    
    
    
    
    
    
    
    
    <div id="header">
      <table width="100%" id="topTable"><tr>
          <td align="left">
            <span id="headerBold">getExportedKeys 方法 (SQLServerDatabaseMetaData)</span>
          </td>
          <td align="right">
            
          </td>
        </tr></table>
      
      
      
    </div>
    <div id="mainSection">
      
        
        
    <font color="DarkGray">
      
    </font>
    <p />
    
    <p />
  
        <div id="introductionSection" class="section">
    <p>检索引用给定表的主键列的外键列的说明。</p>
  </div><h1 class="heading">语法</h1><div id="syntaxSection" class="section"><div class="sampleCode"><span codeLanguage="other"><pre>
public java.sql.ResultSet <b>getExportedKeys</b>(java.lang.String <i>cat</i>,
java.lang.String <i>schema</i>,
java.lang.String <i>table</i>)</pre></span></div><h1 class="heading">参数</h1><div id="parametersSection" class="section" name="collapseableSection">
    <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">
        <i>cat</i>
      </p>
      <p xmlns="">包含目录名称的<b> String</b>。</p>
      <p xmlns="">
        <i>schema</i>
      </p>
      <p xmlns="">包含架构名称的<b> String</b>。</p>
      <p xmlns="">
        <i>table</i>
      </p>
      <p xmlns="">包含表名称的<b> String</b>。</p>
    </content>
  </div></div><h1 class="heading">返回值</h1><div id="returnValueSection" class="section" name="collapseableSection">
    <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns=""><a href="eaffcff1-286c-459f-83da-3150778480c9.htm">SQLServerResultSet</a> 对象。</p>
    </content>
  </div><h1 class="heading">异常</h1><div id="exceptionsSection" class="section" name="collapseableSection">
    <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">
        <a href="af5ef257-7cf6-4db3-b1ee-07d22d82bef1.htm">SQLServerException</a>
      </p>
    </content>
  </div><h1 class="heading">备注</h1><div id="remarksSection" class="section" name="collapseableSection">
    <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">此 <b>getExportedKeys</b> 方法由 java.sql.DatabaseMetaData 接口中的 <b>getExportedKeys</b> 方法指定。</p>
      <p xmlns="">由 <b>getExportedKeys</b> 方法返回的结果集将包含下列信息：</p>
      <table width="100%" cellspacing="0" cellpadding="0" border="1" style="background-color: #CCCCCC;" xmlns=""><tr>
            <th colspan="">
              名称
            </th>
            <th colspan="">
              类型
            </th>
            <th colspan="">
              说明
            </th>
          </tr><tr>
          <td colspan="">
            <p>PKTABLE_CAT</p>
          </td>
          <td colspan="">
            <p>
              <b>String</b>
            </p>
          </td>
          <td colspan="">
            <p>包含主键表的目录名称。</p>
          </td>
        </tr><tr>
          <td colspan="">
            <p>PKTABLE_SCHEM</p>
          </td>
          <td colspan="">
            <p>
              <b>String</b>
            </p>
          </td>
          <td colspan="">
            <p>主键表的架构名称。</p>
          </td>
        </tr><tr>
          <td colspan="">
            <p>PKTABLE_NAME</p>
          </td>
          <td colspan="">
            <p>
              <b>String</b>
            </p>
          </td>
          <td colspan="">
            <p>主键表的名称。</p>
          </td>
        </tr><tr>
          <td colspan="">
            <p>PKCOLUMN_NAME</p>
          </td>
          <td colspan="">
            <p>
              <b>String</b>
            </p>
          </td>
          <td colspan="">
            <p>主键的列名称。</p>
          </td>
        </tr><tr>
          <td colspan="">
            <p>FKTABLE_CAT</p>
          </td>
          <td colspan="">
            <p>
              <b>String</b>
            </p>
          </td>
          <td colspan="">
            <p>包含外键表的目录名称。</p>
          </td>
        </tr><tr>
          <td colspan="">
            <p>FKTABLE_SCHEM</p>
          </td>
          <td colspan="">
            <p>
              <b>String</b>
            </p>
          </td>
          <td colspan="">
            <p>外键表的架构名称。</p>
          </td>
        </tr><tr>
          <td colspan="">
            <p>FKTABLE_NAME</p>
          </td>
          <td colspan="">
            <p>
              <b>String</b>
            </p>
          </td>
          <td colspan="">
            <p>外键表的名称。</p>
          </td>
        </tr><tr>
          <td colspan="">
            <p>FKCOLUMN_NAME</p>
          </td>
          <td colspan="">
            <p>
              <b>String</b>
            </p>
          </td>
          <td colspan="">
            <p>外键的列名称。</p>
          </td>
        </tr><tr>
          <td colspan="">
            <p>KEY_SEQ</p>
          </td>
          <td colspan="">
            <p>
              <b>short</b>
            </p>
          </td>
          <td colspan="">
            <p>多列主键中列的序列号。</p>
          </td>
        </tr><tr>
          <td colspan="">
            <p>UPDATE_RULE</p>
          </td>
          <td colspan="">
            <p>
              <b>short</b>
            </p>
          </td>
          <td colspan="">
            <p>SQL 操作为更新时对外键应用该操作。可以是下列值之一：</p>
            <p>importedKeyNoAction (3)</p>
            <p>importedKeyCascade (0)</p>
            <p>importedKeySetNull (2)</p>
            <p>importedKeySetDefault (4)</p>
            <p>importedKeyRestrict (1)</p>
          </td>
        </tr><tr>
          <td colspan="">
            <p>DELETE_RULE</p>
          </td>
          <td colspan="">
            <p>
              <b>short</b>
            </p>
          </td>
          <td colspan="">
            <p>SQL 操作为删除时对外键应用该操作。可以是下列值之一：</p>
            <p>importedKeyNoAction (3)</p>
            <p>importedKeyCascade (0)</p>
            <p>importedKeySetNull (2)</p>
            <p>importedKeySetDefault (4)</p>
            <p>importedKeyRestrict (1)</p>
          </td>
        </tr><tr>
          <td colspan="">
            <p>FK_NAME</p>
          </td>
          <td colspan="">
            <p>
              <b>String</b>
            </p>
          </td>
          <td colspan="">
            <p>外键的名称。</p>
          </td>
        </tr><tr>
          <td colspan="">
            <p>PK_NAME</p>
          </td>
          <td colspan="">
            <p>
              <b>String</b>
            </p>
          </td>
          <td colspan="">
            <p>主键的名称。</p>
          </td>
        </tr><tr>
          <td colspan="">
            <p>DEFERRABILITY</p>
          </td>
          <td colspan="">
            <p>
              <b>short</b>
            </p>
          </td>
          <td colspan="">
            <p>指示对外键约束的计算是否可以延迟到提交时。可以是下列值之一：</p>
            <p>importedKeyInitiallyDeferred (5)</p>
            <p>importedKeyInitiallyImmediate (6)</p>
            <p>importedKeyNotDeferrable (7)</p>
          </td>
        </tr></table>
      <div style="margin: .5em 1.5em .5em 1.5em" xmlns=""><b>注意：</b>
        有关 <b>getExportedKeys</b> 方法返回的数据的详细信息，请参阅 SQL Server 联机丛书中的“sp_fkeys (Transact-SQL)”。<p />
      </div>
    </content>
  </div><h1 class="heading">示例</h1><div id="codeExampleSection" class="section" name="collapseableSection">
    <description xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <content>
        <p xmlns="">以下示例演示了如何使用 <b>getExportedKeys</b> 方法返回有关引用 SQL Server 2005 AdventureWorks 示例数据库中 Person.Contact 表的主键的所有外键信息。</p>
      </content>
    </description>
    <div class="sampleCode"><span codeLanguage="other"><pre>public static void executeGetExportedKeys(Connection con) {
   try {
      DatabaseMetaData dbmd = con.getMetaData();
      ResultSet rs = dbmd.getExportedKeys("AdventureWorks", "Person", "Contact");
      ResultSetMetaData rsmd = rs.getMetaData();

      // Display the result set data.
      int cols = rsmd.getColumnCount();
      while(rs.next()) {
         for (int i = 1; i &lt;= cols; i++) {
            System.out.println(rs.getString(i));
         }
      }
      rs.close();
   } 

   catch (Exception e) {
      e.printStackTrace();
   }
}</pre></span></div>
  </div><span id="seeAlsoSpan"><h1 class="heading">请参阅</h1></span><div id="seeAlsoSection" class="section" name="collapseableSection"><a href="8b8049d0-8c6d-4476-866b-098709f37eec.htm">SQLServerDatabaseMetaData 类</a><br /><a href="772de447-c922-4b85-8e10-5f0d9277966c.htm">SQLServerDatabaseMetaData 方法</a><br /><a href="327ba0bc-438a-494c-b119-1cd4a096bb58.htm">SQLServerDatabaseMetaData 成员</a><br /><br /></div><!--[if gte IE 5]>
			<tool:tip element="seeAlsoToolTip" avoidmouse="false"/><tool:tip element="languageFilterToolTip" avoidmouse="false"/><tool:tip element="roleInfoSpan" avoidmouse="false"/>
		<![endif]-->
      <div id="footer" class="section">
        
		<hr />
		
		<span id="fb" class="feedbackcss">
			
			
		</span>
		
		<a href="9bad553b-9e70-4696-8499-2e35f772a1e0.htm">
			
			© 2010 Microsoft Corporation。保留所有权利。
		</a>
 	
	
      </div>
    </div>
  </body>
</html>